package com.me.iot.tools;

import com.me.iot.domain.MeIOTSocketConfigInfo;
import jdk.jfr.Configuration;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.PropertyResourceBundle;

@Component
@PropertySource("classpath:meiot.properties")
public class ConfigurationLoadTool {
    @Value("${applicationNameEN}")
    String appNameEN;

    @Value("${applicationNameCN}")
    String appNameCN;

    @Value("${socketPort}")
    Integer socketPort;

    @Value("${socketBufferSize}")
    Integer socketBufferSize;

    @Value("${socketClientNum}")
    Integer socketClientNum;

    public MeIOTSocketConfigInfo doRead() {
        MeIOTSocketConfigInfo socketConfigInfo = new MeIOTSocketConfigInfo();
        socketConfigInfo.setApplicationNameEN(appNameEN);
        socketConfigInfo.setApplicationNameCN(appNameCN);
        socketConfigInfo.setSocketPort(socketPort);
        socketConfigInfo.setSocketBufferSize(socketBufferSize);
        socketConfigInfo.setSocketClientNum(socketClientNum);
        return socketConfigInfo;
    }
}
